﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAPICodePack.Taskbar;

namespace Pibby
{
	public class WindowsSevenProgressIndicator : IProgressIndicator
	{
		public void StartProgressIndicator(int totalItems)
		{
			if (TaskbarManager.IsPlatformSupported)
			{
				TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal);
				TaskbarManager.Instance.SetProgressValue(0, totalItems);
			}
		}

		public void UpdateProgressIndicator(int current, int total)
		{
			if (TaskbarManager.IsPlatformSupported && total > 0)
			{
				TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal);
				TaskbarManager.Instance.SetProgressValue(current, total);
			}
		}

		public void StopProgressIndicator()
		{
			if (TaskbarManager.IsPlatformSupported)
			{
				TaskbarManager.Instance.SetProgressValue(0, 100);
				TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
			}
		}
	}
}
